<template>
	<view>
		<view class="topbox">
			<view class=""
				style="background-color: #fff;display: flex;border-radius: 40rpx;padding: 15rpx;justify-content: space-between;align-items: center;">
				<input type="text" placeholder="请输入\医生姓名/手机号" style="margin-left: 20rpx;" v-model="keywords"  @input="getdata"/>
				<image src="../../static/myGroup/suosou.png" mode=""
					style="width: 40rpx;height:40rpx;margin-right: 20rpx;"></image>
			</view>
			
		</view>
		<view class="" style="display: flex;justify-content: space-between;margin-top: 15rpx;padding: 15rpx;align-items: center;">
			<view class="" style="font-weight: bold;padding-left: 10rpx;border-left: 4px solid #1262DB;">
				医生列表
			</view>
			<view class="" style="padding: 10rpx 20rpx;background-color: #1262DB;color: #fff;border-radius: 15rpx;" @click="add_doctor">
				添加医生
			</view>
		</view>
		
		<view class="">
			<view class="" style="display: flex;align-items: center;padding: 20rpx;margin-top: 20rpx;" v-for="(item,index) in datalist">
				<view class="">
					<image :src="url+item.avatar" style="width: 130rpx;height: 130rpx;border-radius: 50%;" mode=""></image>
				</view>
				<view class="" style="margin-left: 20rpx;display: flex;flex-direction: column;">
					<view class="" style="font-weight: bold;">
						医生姓名：{{item.nickname}}
					</view>
					<view class="" style="color: #b5b5b5;font-size: 24rpx;">
						加入时间：{{item.createtime}}
					</view>
					<view class="" style="color: #b5b5b5;font-size: 24rpx;">
						联系电话：{{item.mobile}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keywords:'',
				url: this.global.url,
				datalist:[]
			}
		},
		onShow() {
			console.log(uni.getStorageSync('clinic_id'))
			this.getdata()
		},
		methods: {
			add_doctor(){
				uni.navigateTo({
					url:'/pages/clinic/adddoctor'
				})
			},
			getdata(){
				let that = this
				console.log('请求的status',that.nav_index)
				uni.showLoading({
					title:"加载中"
				})
				uni.request({
					url: that.global.url + 'api/clinic/doctor_list',
					method: 'POST',
					header: {
						
					},
					data: {
						clinic_id: uni.getStorageSync('clinic_id'),
						keyword:that.keywords
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							// 存用户信息
							that.datalist = result.data
						} else {
							uni.showToast({
								title: result.msg,
								icon: 'none'
							})
						}
					},
					complete() {
						uni.hideLoading()
					}
				})
			},
		}
	}
</script>

<style>
.topbox {
		padding: 30rpx;
		background-color: #1262DB;
	}

	.choice {
		color: #fff;
		font-weight: bold;
		border-bottom: 2px solid #fff;
		padding-bottom: 10rpx;
	}

	.cds {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin: 0px auto;
		margin-top: 15px;
		color: #a7bbed;
		width: 93%;
	}
	.ccc{
		    width: 30%;
		    height: 227rpx;
		    margin: 0px auto;
		    margin-top: 30%;
	}
	.xian {
		border-bottom: 1px solid #e2e2e2;
		margin: 30rpx 0rpx;
	}

	.btn_b {
		border: 2px solid #1262DB;
		padding: 10rpx 20rpx;
		color: #1262DB;
		font-size: 28rpx;
		border-radius: 15rpx;
	}

	.btn_c {
		background: #1262DB;
		color: #fff;
		width: 100%;
		padding: 20rpx;
		text-align: center;
		margin-top: 15rpx;
		border-radius: 15rpx;
	}
</style>
